<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />

         <script language="JavaScript" src="<c:url value='/js/jquery.js'/>"></script>
         <script type="text/javascript" src="<c:url value='/js/jquery.pagination.js'/>"></script>
		 
		 
		         <script type="text/javascript">
   	
            $(document).ready(function(){
		<c:if test="${addorupdate=='add'}">
					        $("[name=htSmsConfigVO.is_beuse]")[0].checked = true;
							</c:if>

		
		   });
			
				function check()
			{
			return true;
			}
			
			
function countStrByte(message){
var byteCount=0;
var preAdd= 0;
var i=0;
var maxValue=134;

  for(i=0;i<message.length;i++){    
  preAdd=byteCount;
    byteCount=(message.charCodeAt(i)<=256)?byteCount+1:byteCount+2;
	
	
	 if(byteCount>maxValue){    
	 var premsg=message.substring(0,i);
$("[name=htSmsConfigVO.config_content]").attr("value",premsg);
              //  message.value=strValue.substring(0,i);    
                alert("内容最多不能超过"+maxValue+"个字节！\n注意:一个汉字为两个字节。");    
                byteCount=maxValue;    
                break;    
            }    

	
		}
var curlen=134-byteCount;

if(curlen<0)
{
//alert("已超过短信字数限制");
//var premsg=message.substring(0,message.length-1);
//$("[name=htSmsConfigVO.config_content]").attr("value",premsg);
$("#curcount").html("0");

}
else
{

$("#curcount").html(curlen);
}

}
			
			    </script>
			
</head>

<body>
<!--main-->

<div align="center"><font color="red">${requestScope.tip }</font></div>
<div class="bian" style="width: 100%">
			<table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" bgcolor="#DEECF3">
					<tr>
						<td width="16" align="right">&nbsp;</td>
						<td width="27" align="left"><img src="../images/san2.gif" width="17" height="16" /></td>
						<td width="571" align="left"><span class="wen2">
						<c:if test="${addorupdate=='add'}">
 <c:set var="addorupdateinfo" value="短信内容添加"/>
 </c:if>
 <c:if test="${addorupdate=='update'}">
 <c:set var="addorupdateinfo" value="短信内容修改"/>
 </c:if>${addorupdateinfo}
						</span></td>
						<td align="center" valign="middle"></td>
					</tr>
			</table>
</div>
<div style="padding:10px;">	
<s:form id="form1">

  <table width="100%"  border="0" cellpadding="0" cellspacing="8" border-style="ridge"	bgcolor="#E8F1F7" align="center">
 <tr>
      <td height="28" colspan="7">&nbsp; </td></tr>
    <tr>
      <td width="25%" align="right">短信内容：</td>
      <td colspan="6"><s:textarea name="htSmsConfigVO.config_content"  onkeyup="countStrByte(this.value);" theme="simple"  rows="5" cols="38"/> <font color="red">*</font>
	  
	 剩余 <span id="curcount"   style="color:#FF0000">134</span>字节
	  </td>
    </tr>
	     <tr>
      <td align="right">短信类型：</td>
      <td colspan="6">
	  

	  
	  </td>     
    </tr>
   <c:set var="operatorDepId" value="${requestScope.operatorDepId}"/> 
    <c:if test="${operatorDepId=='1'}">
    <tr>
      <td align="right">是否启用：</td>
      <td colspan="6">
	  


	  
	  </td>
    </tr>
  
      </c:if>
    
    
	
	    
  <tr>
     
      <td colspan="4" align="center" height="40"> 
	  <s:hidden name="htSmsConfigVO.config_op" required="true"/>
	  <s:hidden name="htSmsConfigVO.config_id" required="true"/>
    <input id="addorupdate" name="addorupdate" type="hidden" value="${addorupdate}">
	   <input type="submit"  style="margin-right:80px"  value="提 交" class="btnblue1" onClick="return check();" />

	   

   </td><td colspan="3"></td>
    </tr>
<tr>
<td colspan="7"  height="230" valign="top" style="line-height:22px;padding-left:160px"><br/><br/> &nbsp; &nbsp; 常用模板代码(仅对系统类短信有效)：<br/>
&nbsp; &nbsp; <font color="#FF0000">接收人姓名[user_name]  &nbsp; &nbsp; 接收人所订产品名称[pro_name] <br/>   &nbsp; &nbsp; 接收人所订产品订单号[order_id]    &nbsp; &nbsp; 接收人所订产品金额[order_amount].</font>


 </td>
</tr>
  </table>
  
</s:form>

</div>

</body>
</html>
